.class Lcn/domob/android/ads/j;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcn/domob/android/ads/j$a;
    }
.end annotation


# static fields
.field private static final e:Ljava/lang/String; = "url"

.field private static final f:Ljava/lang/String; = "failsafe"

.field private static final g:Ljava/lang/String; = "pkg"

.field private static final h:Ljava/lang/String; = "activity"

.field private static final i:Ljava/lang/String; = "param"


# instance fields
.field a:Lcn/domob/android/ads/H;

.field private b:Landroid/content/Context;

.field private c:Landroid/net/Uri;

.field private d:Lcn/domob/android/ads/j$a;


# direct methods
.method constructor <init>(Landroid/content/Context;Landroid/net/Uri;Lcn/domob/android/ads/j$a;)V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Lcn/domob/android/ads/H;

    const-class v1, Lcn/domob/android/ads/j;

    invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Lcn/domob/android/ads/H;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    iput-object p1, p0, Lcn/domob/android/ads/j;->b:Landroid/content/Context;

    iput-object p2, p0, Lcn/domob/android/ads/j;->c:Landroid/net/Uri;

    iput-object p3, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    return-void
.end method

.method private a(Landroid/net/Uri;)Landroid/content/Intent;
    .locals 9

    const/4 v7, 0x0

    const/high16 v5, 0x1000

    const/4 v0, 0x0

    const-string v1, "url"

    invoke-virtual {p1, v1}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "pkg"

    invoke-virtual {p1, v2}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "activity"

    invoke-virtual {p1, v3}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    const-string v4, "param"

    invoke-virtual {p1, v4}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    if-eqz v1, :cond_1

    :try_start_0
    const-string v2, "UTF-8"

    invoke-static {v1, v2}, Ljava/net/URLDecoder;->decode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    new-instance v2, Landroid/content/Intent;

    const-string v3, "android.intent.action.VIEW"

    invoke-direct {v2, v3, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    const/high16 v0, 0x1000

    :try_start_1
    invoke-virtual {v2, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    move-object v0, v2

    :cond_0
    :goto_0
    if-eqz v0, :cond_4

    if-eqz v4, :cond_4

    const-string v1, ""

    invoke-virtual {v4, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_4

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "QueryParams : "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcn/domob/android/ads/H;->a(Ljava/lang/String;)V

    const-string v1, ";"

    invoke-virtual {v4, v1}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v1

    array-length v2, v1

    move v3, v7

    :goto_1
    if-ge v3, v2, :cond_4

    aget-object v4, v1, v3

    const-string v5, ","

    invoke-virtual {v4, v5}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v4

    aget-object v5, v4, v7

    const/4 v6, 0x1

    aget-object v4, v4, v6

    invoke-virtual {v0, v5, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    add-int/lit8 v3, v3, 0x1

    goto :goto_1

    :catch_0
    move-exception v1

    move-object v8, v1

    move-object v1, v0

    move-object v0, v8

    :goto_2
    iget-object v2, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    const-string v3, "Error happened in decoding launchURL"

    invoke-virtual {v2, v3}, Lcn/domob/android/ads/H;->e(Ljava/lang/String;)V

    iget-object v2, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    invoke-virtual {v2, v0}, Lcn/domob/android/ads/H;->a(Ljava/lang/Throwable;)V

    move-object v0, v1

    goto :goto_0

    :cond_1
    if-eqz v2, :cond_3

    const-string v1, ""

    invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_3

    if-eqz v3, :cond_2

    const-string v0, ""

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_2

    iget-object v0, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    const-string v1, "Activity is not null"

    invoke-virtual {v0, v1}, Lcn/domob/android/ads/H;->a(Ljava/lang/String;)V

    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    new-instance v1, Landroid/content/ComponentName;

    invoke-direct {v1, v2, v3}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    invoke-virtual {v0, v5}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    goto :goto_0

    :cond_2
    iget-object v0, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    const-string v1, "Activity is null"

    invoke-virtual {v0, v1}, Lcn/domob/android/ads/H;->a(Ljava/lang/String;)V

    iget-object v0, p0, Lcn/domob/android/ads/j;->b:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    invoke-virtual {v0, v2}, Landroid/content/pm/PackageManager;->getLaunchIntentForPackage(Ljava/lang/String;)Landroid/content/Intent;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {v0, v5}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    goto/16 :goto_0

    :cond_3
    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    const-string v2, "Package name is null or empty."

    invoke-virtual {v1, v2}, Lcn/domob/android/ads/H;->e(Ljava/lang/String;)V

    goto/16 :goto_0

    :cond_4
    return-object v0

    :catch_1
    move-exception v0

    move-object v1, v2

    goto :goto_2
.end method


# virtual methods
.method protected a()V
    .locals 4

    iget-object v0, p0, Lcn/domob/android/ads/j;->c:Landroid/net/Uri;

    invoke-direct {p0, v0}, Lcn/domob/android/ads/j;->a(Landroid/net/Uri;)Landroid/content/Intent;

    move-result-object v0

    if-nez v0, :cond_2

    :try_start_0
    new-instance v0, Ljava/lang/Exception;

    const-string v1, "Action intent is null."

    invoke-direct {v0, v1}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    throw v0
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :catch_0
    move-exception v0

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Failed to launch app with URL:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, p0, Lcn/domob/android/ads/j;->c:Landroid/net/Uri;

    invoke-virtual {v3}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcn/domob/android/ads/H;->e(Ljava/lang/String;)V

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    invoke-virtual {v1, v0}, Lcn/domob/android/ads/H;->a(Ljava/lang/Throwable;)V

    iget-object v0, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    invoke-interface {v0}, Lcn/domob/android/ads/j$a;->F()V

    :cond_0
    iget-object v0, p0, Lcn/domob/android/ads/j;->c:Landroid/net/Uri;

    const-string v1, "failsafe"

    invoke-virtual {v0, v1}, Landroid/net/Uri;->getQueryParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_1

    :try_start_1
    const-string v1, "UTF-8"

    invoke-static {v0, v1}, Ljava/net/URLDecoder;->decode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Backup action ----- Open landing page with URL:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcn/domob/android/ads/H;->a(Ljava/lang/String;)V

    iget-object v1, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    invoke-interface {v1, v0}, Lcn/domob/android/ads/j$a;->h(Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_1 .. :try_end_1} :catch_1

    :cond_1
    :goto_0
    return-void

    :cond_2
    :try_start_2
    iget-object v1, p0, Lcn/domob/android/ads/j;->b:Landroid/content/Context;

    invoke-virtual {v1, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    iget-object v0, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcn/domob/android/ads/j;->d:Lcn/domob/android/ads/j$a;

    invoke-interface {v0}, Lcn/domob/android/ads/j$a;->E()V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_0

    :catch_1
    move-exception v0

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    const-string v2, "Invalid failsafe URL."

    invoke-virtual {v1, v2}, Lcn/domob/android/ads/H;->e(Ljava/lang/String;)V

    iget-object v1, p0, Lcn/domob/android/ads/j;->a:Lcn/domob/android/ads/H;

    invoke-virtual {v1, v0}, Lcn/domob/android/ads/H;->a(Ljava/lang/Throwable;)V

    goto :goto_0
.end method
